package com.hs.jhzd.repository;

import java.util.Date;
import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import com.hs.jhzd.entity.SwipeRecord;

public interface SwipeRecordRepository extends JpaRepository<SwipeRecord, Long> {

  @Query("select u from SwipeRecord u where u.jsbh= :jsbh and u.jsh= :jsh and (u.sksj between :startTime and :endTime) and u.sklx= :swipeType")
  List<SwipeRecord> findSwipeRecord(@Param("jsbh") String jsbh, @Param("jsh") String jsh,
      @Param("startTime") Date startTime, @Param("endTime") Date endTime,
      @Param("swipeType") String swipeType);

  @Query("select u from SwipeRecord u where u.jsbh= :jsbh and (u.sksj between :startTime and :endTime) and u.sklx= :swipeType")
  List<SwipeRecord> findSwipeRecordByJsbh(@Param("jsbh") String jsbh,
      @Param("startTime") Date startTime, @Param("endTime") Date endTime,
      @Param("swipeType") String swipeType);

}
